##Author: Guangfu Wang.

#add_library(assimp STATIC IMPORTED)
#set_target_properties(assimp
#        PROPERTIES
#        IMPORTED_LOCATION
#        ${CMAKE_SOURCE_DIR}/Dependencies/assimp/lib/windows/libassimp.a)

set(ASSIMP_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/Dependencies/assimp/include")
set(ASSIMP_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/Dependencies/assimp/include")

include(${CMAKE_SOURCE_DIR}/ShapeAnalysis/cmake/assimpConfigVersion.cmake)

if (${CMAKE_HOST_WIN32})
    set(ASSIMP_LIB "${CMAKE_SOURCE_DIR}/Dependencies/assimp/lib/windows/libassimp.a")
    set(ASSIMP_LIBS "${CMAKE_SOURCE_DIR}/Dependencies/assimp/lib/windows/libassimp.a")

    set(ASSIMP_FOUND TRUE)
    set(assimp_FOUND TRUE)
    include_directories(${ASSIMP_INCLUDE_DIR})
    message(STATUS "Found assimp, Version: ${PACKAGE_VERSION}")
elseif (${CMAKE_HOST_UNIX})
    ##TODO: linux support and test will come soon.
    set(ASSIMP_LIB "${CMAKE_SOURCE_DIR}/Dependencies/assimp/lib/linux/libassimp.a")
    set(ASSIMP_LIBS "${CMAKE_SOURCE_DIR}/Dependencies/assimp/lib/linux/libassimp.a")

    set(ASSIMP_FOUND TRUE)
    set(assimp_FOUND TRUE)
    include_directories(${ASSIMP_INCLUDE_DIR})
    message(STATUS "Found assimp, Version: ${PACKAGE_VERSION}")
elseif (${CMAKE_HOST_APPLE})
    ##TODO: APPLE SUPPORT AND TEST WILL COME SOON.
    set(ASSIMP_LIB "${CMAKE_SOURCE_DIR}/Dependencies/assimp/lib/apple/libassimp.a")
    set(ASSIMP_LIBS "${CMAKE_SOURCE_DIR}/Dependencies/assimp/lib/apple/libassimp.a")

    include(${CMAKE_SOURCE_DIR}/ShapeAnalysis/cmake/assimpConfigVersion.cmake)
    set(ASSIMP_FOUND TRUE)
    set(assimp_FOUND TRUE)
    include_directories(${ASSIMP_INCLUDE_DIR})
    message(STATUS "Found assimp, Version: ${PACKAGE_VERSION}")
else ()
    message(WARNING "Unsupported OS of assimp...")

    unset(ASSIMP_INCLUDE_DIR)
    unset(ASSIMP_INCLUDE_DIRS)

    unset(ASSIMP_LIB)
    unset(ASSIMP_LIBS)

    set(ASSIMP_FOUND OFF)
    set(assimp_FOUND OFF)
endif ()
